package cn.dnui_xcz826.dnuifood_16110100826.model;

import cn.dnui_xcz826.dnuifood_16110100826.iface.CommentIface;
import cn.dnui_xcz826.dnuifood_16110100826.listener.onRetrofitListener;
import cn.dnui_xcz826.dnuifood_16110100826.service.CommentService;
import retrofit2.Call;

/**
 * Created by Administrator on 2018/11/19.
 */

public class CommentModel extends BaseModel implements CommentIface {
    private CommentService service;
    public CommentModel(){
        //super();
        service=retrofit.create(CommentService.class);
    }

    @Override
    public void getAllCommentsByFood(String food_id, onRetrofitListener listener) {
        Call call=service.doGetAllCommentsByFood(food_id);
        bindCallback(call,listener,15);
    }

    @Override
    public void getAllCommentsByUser(String user_id, onRetrofitListener listener) {
        Call call=service.doGetAllCommentsByUser(user_id);
        bindCallback(call,listener,16);
    }

    @Override
    public void insertComment(String item_id, String content, onRetrofitListener listener) {
        Call call=service.doInserComment(item_id,content);
        bindCallback(call,listener,17);
    }

    @Override
    public void updateComment(String item_id, String content, onRetrofitListener listener) {
        Call call=service.doUpdateComment(item_id,content);
        bindCallback(call,listener,18);
    }

    @Override
    public void deleteComment(String item_id, onRetrofitListener listener) {
        Call call=service.doDeleteComment(item_id);
        bindCallback(call,listener,19);
    }
}
